The main GDK thread lock is not portable and deprecated.
The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.
Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.
https://bugzilla.gnome.org/show_bug.cgi?id=793124
{
if (flush_id == 0)
{
- flush_id = gdk_threads_add_idle (flush_idle, NULL);
+ flush_id = g_idle_add (flush_idle, NULL);
g_source_set_name_by_id (flush_id, "[gtk+] flush_idle");
}
}
*/
if (!screen->screen_changed_id)
{
- screen->screen_changed_id = gdk_threads_add_idle (screen_changed_idle, screen);
+ screen->screen_changed_id = g_idle_add (screen_changed_idle, screen);
g_source_set_name_by_id (screen->screen_changed_id, "[gtk+] screen_changed_idle");
}
}
if (state->callback)
{
guint id;
- id = gdk_threads_add_idle (callback_idle, state);
+ id = g_idle_add (callback_idle, state);
g_source_set_name_by_id (id, "[gtk+] callback_idle");
}
if (state->callback)
{
guint id;
- id = gdk_threads_add_idle (roundtrip_callback_idle, state);
+ id = g_idle_add (roundtrip_callback_idle, state);
g_source_set_name_by_id (id, "[gtk+] roundtrip_callback_idle");
}
if (!item->action_idle_handler)
{
- item->action_idle_handler = gdk_threads_add_idle (idle_do_action, item);
+ item->action_idle_handler = g_idle_add (idle_do_action, item);
g_source_set_name_by_id (item->action_idle_handler, "[gtk+] idle_do_action");
}
load_data->items = NULL;
/* begin lazy loading the recent files into the model */
- priv->load_recent_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT,
- recent_idle_load,
- load_data,
- recent_idle_cleanup);
+ priv->load_recent_id = g_idle_add_full (G_PRIORITY_DEFAULT,
+ recent_idle_load,
+ load_data,
+ recent_idle_cleanup);
g_source_set_name_by_id (priv->load_recent_id, "[gtk+] recent_idle_load");
}
if (!priv->theme_changed_idle)
{
- priv->theme_changed_idle =
- gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2,
- theme_changed_idle, icon_theme, NULL);
+ priv->theme_changed_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2,
+ theme_changed_idle,
+ icon_theme,
+ NULL);
g_source_set_name_by_id (priv->theme_changed_idle, "[gtk+] theme_changed_idle");
}
}
box = box->toplevel;
if (!box->separator_sync_idle)
- box->separator_sync_idle = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE, /* before resize... */
- gtk_menu_section_box_handle_sync_separators,
- box, NULL);
+ {
+ box->separator_sync_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE, /* before resize... */
+ gtk_menu_section_box_handle_sync_separators,
+ box, NULL);
+ g_source_set_name_by_id (box->separator_sync_idle, "[gtk+] menu section box handle sync separators");
+ }
}
static void
g_object_ref (preview);
- id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
- preview_print_idle,
- pop,
- preview_print_idle_done);
+ id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 10,
+ preview_print_idle,
+ pop,
+ preview_print_idle_done);
g_source_set_name_by_id (id, "[gtk+] preview_print_idle");
}
priv->manual_number_up_layout = gtk_print_settings_get_number_up_layout (priv->print_settings);
}
- priv->print_pages_idle_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
- print_pages_idle,
- data,
- print_pages_idle_done);
+ priv->print_pages_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 10,
+ print_pages_idle,
+ data,
+ print_pages_idle_done);
g_source_set_name_by_id (priv->print_pages_idle_id, "[gtk+] print_pages_idle");
/* Recursive main loop to make sure we don't exit on sync operations */
if (priv->mark_conflicts_id != 0)
return;
- priv->mark_conflicts_id = gdk_threads_add_idle (mark_conflicts_callback,
- dialog);
+ priv->mark_conflicts_id = g_idle_add (mark_conflicts_callback, dialog);
g_source_set_name_by_id (priv->mark_conflicts_id, "[gtk+] mark_conflicts_callback");
}
if (model->query == NULL)
return;
- model->idle = gdk_threads_add_idle (do_search, engine);
+ model->idle = g_idle_add (do_search, engine);
g_source_set_name_by_id (model->idle, "[gtk+] gtk_search_engine_model_start");
}
batch->hits = data->hits;
batch->thread_data = data;
- id = gdk_threads_add_idle (search_thread_add_hits_idle, batch);
+ id = g_idle_add (search_thread_add_hits_idle, batch);
g_source_set_name_by_id (id, "[gtk+] search_thread_add_hits_idle");
}
if (!g_cancellable_is_cancelled (data->cancellable))
send_batch (data);
- id = gdk_threads_add_idle (search_thread_done_idle, data);
+ id = g_idle_add (search_thread_done_idle, data);
g_source_set_name_by_id (id, "[gtk+] search_thread_done_idle");
return NULL;
* so we don't wait until the entire buffer has been validated. */
if (!priv->im_spot_idle)
{
- priv->im_spot_idle = gdk_threads_add_idle_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE - 1,
- do_update_im_spot_location,
- text_view,
- NULL);
+ priv->im_spot_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE - 1,
+ do_update_im_spot_location,
+ text_view,
+ NULL);
g_source_set_name_by_id (priv->im_spot_idle, "[gtk+] do_update_im_spot_location");
}
}
if (!priv->first_validate_idle)
{
- priv->first_validate_idle = gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
+ priv->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
g_source_set_name_by_id (priv->first_validate_idle, "[gtk+] first_validate_callback");
DV (g_print (G_STRLOC": adding first validate idle %d\n",
priv->first_validate_idle));
if (!priv->incremental_validate_idle)
{
- priv->incremental_validate_idle = gdk_threads_add_idle_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
+ priv->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
g_source_set_name_by_id (priv->incremental_validate_idle, "[gtk+] incremental_validate_callback");
DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
priv->incremental_validate_idle));
if (!priv->idle_id)
{
- priv->idle_id = gdk_threads_add_idle (slide_idle_handler, toolbar);
+ priv->idle_id = g_idle_add (slide_idle_handler, toolbar);
g_source_set_name_by_id (priv->idle_id, "[gtk+] slide_idle_handler");
}
if (! tree_view->priv->validate_rows_timer)
{
tree_view->priv->validate_rows_timer =
- gdk_threads_add_idle_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows, tree_view, NULL);
+ g_idle_add_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows, tree_view, NULL);
g_source_set_name_by_id (tree_view->priv->validate_rows_timer, "[gtk+] validate_rows");
}
}
if (!tree_view->priv->scroll_sync_timer)
{
tree_view->priv->scroll_sync_timer =
- gdk_threads_add_idle_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
+ g_idle_add_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
g_source_set_name_by_id (tree_view->priv->scroll_sync_timer, "[gtk+] scroll_sync_handler");
}
}
if (tooltip_query_id == 0)
{
- tooltip_query_id = gdk_threads_add_idle (tooltip_query_idle, NULL);
+ tooltip_query_id = g_idle_add (tooltip_query_idle, NULL);
g_source_set_name_by_id (tooltip_query_id, "[gtk+] tooltip_query_idle");
}
}
if (!priv->keys_changed_handler)
{
- priv->keys_changed_handler = gdk_threads_add_idle (handle_keys_changed, window);
+ priv->keys_changed_handler = g_idle_add (handle_keys_changed, window);
g_source_set_name_by_id (priv->keys_changed_handler, "[gtk+] handle_keys_changed");
}
}
if (inspector_window &&
gtk_window_update_debugging_id == 0)
{
- gtk_window_update_debugging_id = gdk_threads_add_idle (update_debugging, NULL);
+ gtk_window_update_debugging_id = g_idle_add (update_debugging, NULL);
g_source_set_name_by_id (gtk_window_update_debugging_id, "[gtk+] gtk_window_update_debugging");
}
}
gtk_widget_show (GTK_WIDGET (info.window));
- gdk_threads_add_idle (stress_test_old_api, &info);
+ g_idle_add (stress_test_old_api, &info);
gtk_widget_show (GTK_WIDGET (info.window));
process_pending_idles ()
{
GMainLoop *loop = g_main_loop_new (NULL, FALSE);
- gdk_threads_add_idle (quit_loop, loop);
+ g_idle_add (quit_loop, loop);
g_main_loop_run (loop);
}